1. Field of the Invention
The present invention generally relates to a buffer control technique. More particularly, the present invention relates to a buffer control method and a buffer control device which decrease use of a buffer memory area and avoid a buffer overflow when data is stored in a buffer memory for packet protocol processing during inputting of data, controlling an output rate of data, and the like.
2. Description of the Related Art
FIG. 1 is a block diagram showing an example of a buffer control device 10. The buffer control device 10 includes a buffer control part 14 for controlling packet processing in a packet processing part 46 and for controlling buffer chaining in a buffer memory 26, and an output scheduling part 12 for controlling an output instruction to the buffer control part 14 and for controlling data output.
The buffer control part 14 has an unallocated buffer head pointer 16, an unallocated buffer last pointer 18, a pointer control part 20 for controlling each pointer, an output head pointer 22, and an output last pointer 24. The operation of the buffer control device 10 is as follows.
When contiguous segments of data 2 are input in the buffer control device 10, buffer chaining in the buffer memory 26 for storing the data is performed by the pointer control part 20 and the data is stored per segment in the buffer memory 26 temporarily. The segment is a data storing unit in the buffer memory 26. In the meantime, if packet processing is required, packet processing, such as a packet assembly, is performed in the packet processing part 46. Moreover, if it is necessary to adjust an output rate beforehand, in other words, if shaping is necessary, data will be stored in the buffer memory 26 over a period of time necessary for adjusting the output rate.
After that, the output scheduling part 12 instructs the buffer control part 14 to output data. Then, the buffer control part 14 controls a pointer and data 4 which is arranged per segment or data 6 which has been assembled into packets is output. On one hand, the data 4 consisting of segments has intervals between the segments, which interval is caused by adjusting the output rate. On the other hand, the data 6 has intervals between packets, which intervals are caused by packet processing.
FIG. 2 is a block diagram showing the configuration of the buffer memory 26. In the following, the configuration of the buffer memory 26 and the function of each of the pointers in the buffer control part 14 in FIG. 1 will be described with reference to FIG. 2.
As shown in FIG. 2, the buffer memory 26 stores an unallocated buffer chain 27 and an output buffer chain 28. Each of the unallocated buffer chain 27 and the output buffer chain 28 includes segments. Hereinafter, each of the segments in the unallocated buffer chain 27 will be called an unallocated segment, and each of the segments in the output buffer chain 28 will be called an output segment.
The unallocated buffer head pointer 16 indicates a head segment address of the unallocated buffer chain 27, and the unallocated buffer last pointer 18 indicates an end segment address of the unallocated buffer chain 27. The output head pointer 22 indicates a head segment address of the output buffer chain 28, and the output last pointer 24 shows an end segment address of the output buffer chain 28. A next segment address 29 in the output segment indicates an address of a next output segment. Input data is stored in each of the output segments.
FIGS. 3A, 3B, and 3C show a case in which three sets of data are stored in the buffer memory 26. When first data is received as shown in FIG. 3A, one segment is allocated as an output segment from an unallocated buffer queue, that is an unallocated buffer chain, and data X-1 is stored in the output segment. The unallocated buffer head pointer 16 points to a next unallocated segment.
As shown in FIGS. 3B and 3C, when a second data and a third data are received, unallocated segments are allocated according to the amount of data. That is, in the conventional buffer control technique, received data is stored in a buffer memory as it is.
Recently, as high-speed communication in which data is highly multiplexed is spreading in an ATM communication and other communication fields, a larger amount of the same data is transmitted at high speed in a case of using a multicasting technique or the like. Therefore, according to the above-mentioned conventional technique in which the amount of the buffer memory is the same as the amount of the data received even if the data is the same data, there are problems that a large memory space is necessary for buffering and that a buffer overflow may occur during packet protocol processing, output rate controlling, and the like.
It is a general object of the present invention to provide a buffer control method and a buffer control device in which the above problems are eliminated.
A more specific object of the present invention is to provide a buffer control method and a buffer control device which decrease use of a buffer memory area and avoid a buffer overflow when data is stored in a buffer memory for packet protocol processing, controlling an output rate, and the like.
The above objects of the present invention are achieved by a buffer control method for controlling a buffer memory, the method including the steps of:
comparing input data with one or more data patterns;
storing a code which indicates a data pattern among data patterns into the buffer memory if the input data matches with the data pattern; and
recovering the input data from the code.
According to the present invention, the usage of the buffer memory can be decreased and a buffer overflow can be avoided since a code instead of input data is written in the buffer memory.